.org 0xE5EC4 ; Repair Increase

Repair_Increase:

	PUSH 	{R4-R5, LR}
	
	SUB  	SP, SP, 4
	
	MOV		R5, 0								; Repair bonus = 0
	
;-------------------------------------------------------------------------------
	
	LDR 	R2, [Repair_Increase_1]
	LDR 	R1, [Repair_Increase_2]	
	LDR 	R3, [R2, 0]
	LDR 	R2, [R1, 0]
	
	MOV 	R1, 0x98		
	ADD 	R2, R3, R2, LSL 2
	MUL		R4, R0, R1
	LDR		R2, [R2, 0x48]
	ADD 	R0, R2, 0x5000
	LDR 	R0, [R0, 0xA58]
	ADD 	R0, R0, R4
	ADD 	R0, R0, 0x74
	
	MOV 	R1, Rank_Mechanic					; Rank: Mechanic
	
	BL 		Check_Skills_Equipped				; Check the Skill is equipped	
	CMP 	R0, 0								; Does CO use that skill?
	ADDNE 	R5, R5, Stats_Mechanic				; If CO use skill, increase base repair

;-------------------------------------------------------------------------------
	
	BL		Skill_Setup_Type_1
		
	MOV 	R1, Rank_Gear_Head					; Rank: Gear Head
	
	BL 		Check_Skills_Equipped				; Check the Skill is equipped	
	CMP 	R0, 0								; Does CO use that skill?
	ADDNE 	R5, R5, Stats_Gear_Head				; If CO use skill, increase base repair

;-------------------------------------------------------------------------------
			
	MOV 	R0, R5								; Total rapair bonus
	
	ADD		SP, SP, 4	
	POP 	{R4-R5, LR}	
	BX 		LR

;-------------------------------------------------------------------------------		

	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP

Repair_Increase_1:
	.dw Reg1_Skill
	
Repair_Increase_2:
	.dw Reg2_Skill



